/*
 * @Description: 道具商城
 * @Author: iamsmiling
 * @Date: 2021-06-13 10:34:48
 * @LastEditTime: 2021-06-13 11:40:01
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/domain/local/prop/func_card_entity.dart';
import 'package:credit_business_circle/routes/app_routes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class PropkitMallBody extends StatelessWidget {
  final List<FuncCardEntity> cards;
  const PropkitMallBody({Key? key, required this.cards}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            margin: EdgeInsets.only(bottom: R.dimen.dp10),
            decoration: BoxDecoration(color: R.color.ffffffff),
            child: Column(
              children: [
                Container(
                  margin:
                      EdgeInsets.only(top: R.dimen.dp24, bottom: R.dimen.dp12),
                  padding: EdgeInsets.symmetric(horizontal: R.dimen.dp11),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text.rich(TextSpan(
                          text: "钱包可用余额：",
                          style: TextStyle(
                              fontSize: R.dimen.sp15,
                              color: R.color.ff333333,
                              fontWeight: FontWeight.w600),
                          children: [
                            TextSpan(
                                text: "236.00",
                                style: TextStyle(
                                    fontSize: R.dimen.sp15,
                                    color: R.color.fffc4a14)),
                            TextSpan(
                              text: " 元",
                            )
                          ])),
                      GestureDetector(
                        onTap: () => Get.toNamed(AppRoutes.mine +
                            AppRoutes.wallet +
                            AppRoutes.recharge),
                        child: Container(
                          padding: EdgeInsets.symmetric(
                              horizontal: R.dimen.dp20, vertical: R.dimen.dp7),
                          decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(R.dimen.sp20),
                              gradient: LinearGradient(colors: [
                                R.color.ff33cda0,
                                R.color.ff25b48a
                              ])),
                          child: Text(
                            "充值",
                            style: TextStyle(
                                fontSize: R.dimen.sp13,
                                color: R.color.ffffffff),
                          ),
                        ),
                      )
                    ],
                  ),
                ),
                Divider(
                  indent: R.dimen.dp11,
                  endIndent: R.dimen.dp11,
                  height: 1,
                ),
                Container(
                  alignment: Alignment.centerLeft,
                  margin: EdgeInsets.symmetric(
                      vertical: R.dimen.dp14, horizontal: R.dimen.dp11),
                  child: Text(
                    "开通VIP会员享全场折扣优惠：月卡9折、季卡7折、年卡5折",
                    style: TextStyle(
                        fontSize: R.dimen.sp13, color: R.color.ffcb9144),
                  ),
                ),
                Container(
                  margin: EdgeInsets.only(
                      top: R.dimen.dp22,
                      bottom: R.dimen.dp11,
                      left: R.dimen.dp11,
                      right: R.dimen.dp11),
                  child: Stack(
                    alignment: AlignmentDirectional.center,
                    children: [
                      Image.asset(
                        R.image.mineVipBg,
                        width: R.dimen.width,
                        fit: BoxFit.fitWidth,
                      ),
                      Container(
                        padding: EdgeInsets.symmetric(horizontal: R.dimen.dp20),
                        child: Row(
                          children: [
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Text(
                                  "会员卡",
                                  style: TextStyle(
                                      color: R.color.fff1e1a2,
                                      fontSize: R.dimen.sp16,
                                      fontWeight: FontWeight.w600),
                                ),
                                Container(
                                  child: Text(
                                    "开通VIP会员立享超值特权",
                                    style: TextStyle(
                                        color: R.color.fffef1cf,
                                        fontSize: R.dimen.sp13),
                                  ),
                                ),
                              ],
                            ),
                            Spacer(),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.end,
                              children: [
                                Container(
                                  padding: EdgeInsets.symmetric(
                                      horizontal: R.dimen.dp20,
                                      vertical: R.dimen.dp5),
                                  decoration: BoxDecoration(
                                      borderRadius:
                                          BorderRadius.circular(R.dimen.sp13),
                                      gradient: LinearGradient(colors: [
                                        R.color.fffbefd0,
                                        R.color.fffae2a0
                                      ])),
                                  child: Text(
                                    "续期",
                                    style: TextStyle(
                                        color: R.color.ff56360e,
                                        fontSize: R.dimen.sp13),
                                  ),
                                ),
                                Container(
                                  margin: EdgeInsets.only(top: R.dimen.dp2),
                                  child: Text(
                                    "有效期至：2020-06-15",
                                    style: TextStyle(
                                        color: R.color.fffbefd0,
                                        fontSize: R.dimen.sp10),
                                  ),
                                )
                              ],
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                ),
              ],
            ),
          ),
          for (FuncCardEntity card in cards)
            Container(
              padding: EdgeInsets.all(R.dimen.dp15),
              decoration: BoxDecoration(
                  color: R.color.ffffffff,
                  borderRadius: BorderRadius.circular(R.dimen.sp8)),
              margin: EdgeInsets.only(
                  left: R.dimen.dp12,
                  right: R.dimen.dp12,
                  bottom: R.dimen.dp10),
              child: Row(
                children: [
                  Container(
                      margin: EdgeInsets.only(right: R.dimen.dp13),
                      child: Image.asset(card.icon)),
                  Expanded(
                      child: Column(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      Text.rich(TextSpan(
                          text: "${card.label}",
                          style: TextStyle(
                              fontSize: R.dimen.sp16,
                              color: R.color.ff111111,
                              fontWeight: FontWeight.w600),
                          children: [
                            TextSpan(
                              text: "  ¥ ",
                              style: TextStyle(
                                  fontSize: R.dimen.sp13,
                                  color: R.color.fff35044),
                            ),
                            TextSpan(
                                text: "${card.price}",
                                style: TextStyle(
                                    fontSize: R.dimen.sp20,
                                    color: R.color.fff35044,
                                    fontWeight: FontWeight.w600))
                          ])),
                      Container(
                        margin: EdgeInsets.only(top: R.dimen.dp9),
                        child: Text(
                          card.description,
                          style: TextStyle(
                              fontSize: R.dimen.sp12, color: R.color.ff666666),
                        ),
                      )
                    ],
                  )),
                  GestureDetector(
                    onTap: () => Get.toNamed(
                        Get.currentRoute + AppRoutes.buyPropkit,
                        arguments: card),
                    child: Container(
                      padding: EdgeInsets.symmetric(
                          horizontal: R.dimen.dp20, vertical: R.dimen.dp7),
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(R.dimen.sp20),
                          gradient: LinearGradient(
                              colors: [R.color.ff1fc896, R.color.ff2eab86])),
                      child: Text(
                        "购买",
                        style: TextStyle(
                            fontSize: R.dimen.sp13, color: R.color.ffffffff),
                      ),
                    ),
                  )
                ],
              ),
            )
        ],
      ),
    );
  }
}
